package com.spring.fisher.service.serviceImpl;

import com.spring.fisher.bean.Users;
import com.spring.fisher.dao.CommonMapper;
import com.spring.fisher.dynamicDataSource.TargetDataSource;
import com.spring.fisher.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    CommonMapper mapper;

    @TargetDataSource(name = "ds1")
    public List<Users> queryUser1() {
        List<Users> usersList = mapper.selectAll();
        return usersList;
    }

    @TargetDataSource(name = "ds2")
    public List<Users> queryUser2() {
        List<Users> usersList = mapper.selectAll();
        return usersList;
    }

}
